package com.adan.auditlog.config;


import com.adan.auditlog.AuditLogAspect;
import com.adan.auditlog.SqlAspect;
import com.adan.auditlog.handler.AuditDeleteByIdHandler;
import com.adan.auditlog.handler.AuditInsertEntityHandler;
import com.adan.auditlog.handler.AuditUpdateEntityByIdHandler;
import com.adan.auditlog.handler.IAuditHandler;
import com.adan.auditlog.service.IOperationLogService;
import com.adan.auditlog.service.IOperationLogServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@Configuration
@EnableAspectJAutoProxy
public class AuditLogConfiguration {
	@Bean
	public SqlAspect sqlAspect() {
		return new SqlAspect();
	}

	@Bean
	public AuditLogAspect auditLogAspect() {
		return new AuditLogAspect();
	}

	@Bean
	public IOperationLogService sqlOperationLogMapper() {
		return new IOperationLogServiceImpl();
	}

	@Bean
	public IAuditHandler auditDeleteByIdHandler() {
		return new AuditDeleteByIdHandler();
	}

	@Bean
	public IAuditHandler auditUpdateEntityByIdHandler() {
		return new AuditUpdateEntityByIdHandler();
	}

	@Bean
	public IAuditHandler auditInertEntityHandler() {
		return new AuditInsertEntityHandler();
	}

	@Bean
	public AuditLogContext auditLogContext() {
		return new AuditLogContext();
	}
}
